package com.cgt.springboot.controller;

import jakarta.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/page")
public class PageController {

	@RequestMapping("/**")
	public String path(HttpServletRequest req){
		String requestURI = req.getRequestURI();
		System.out.println("requestURI:" + requestURI);
		String[] paths = requestURI.split("/");

		if(paths.length == 4){
			return paths[2] + "_" + paths[3];
		} else if(paths.length == 3){
			return paths[2];
		} else {
			return "index";
		}
	}
}
